import calendar


def dateAnay(date):
    dateList = date.split("-")
    monthRange = calendar.monthrange(int(dateList[0]), int(dateList[1]))
    start_day = date + '-1'  # 月初
    end_day = date + '-' + str(monthRange[1])  # 月末
    time = start_day + '|' + end_day
    # return {"start_day": start_day, "end_day": end_day}
    return time


if __name__ == '__main__':
    date = '2018-7'
    print(dateAnay(date))
    print(type(dateAnay(date)))
